home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2207 / 2207.xpi / chrome / cooliris.jar / content / cooliris / webcontrol.js < prev    next >
Text File  |  2010-01-28  |  5KB  |  184 lines

  1. function cooliris_wc_clsWebControl(_1,_2,_3,_4){
  2. this.obj=_1;
  3. this.startPoint=_2;
  4. this.endPoint=_3;
  5. this.callback=null;
  6. this.type=_4;
  7. this.stop=false;
  8. }
  9. cooliris_wc_clsWebControl.prototype={animTimer:null,animDelay:10,numTimes:50,xChange:0,yChange:0,maxTimes:20,startDim:null,endDim:null,setDim:function(_5,_6){
  10. this.startDim=_5;
  11. this.endDim=_6;
  12. },magnify:function(){
  13. var _7=this;
  14. if(this.animTimer==null){
  15. this.numTimes=this.maxTimes;
  16. this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
  17. this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
  18. this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
  19. this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
  20. }
  21. this.startDim.width+=this.wChange;
  22. this.startDim.height+=this.hChange;
  23. this.startPoint.left+=this.xChange;
  24. this.startPoint.top+=this.yChange;
  25. this.obj.style.position="fixed";
  26. if(this.callback!=null){
  27. this.callback(this.startPoint.left,this.startPoint.top,this.startDim.width,this.startDim.height);
  28. }
  29. this.numTimes--;
  30. if(this.numTimes<5){
  31. this.animDelay+=10;
  32. }
  33. this.animTimer=setTimeout(function(){
  34. _7.magnify();
  35. },this.animDelay);
  36. if(this.numTimes==0){
  37. this.reset(cooliris_wc_EffectType.ANIMATE);
  38. this.obj.style.width=this.endDim.width;
  39. this.obj.style.height=this.endDim.height;
  40. this.obj.style.left=this.endPoint.left;
  41. this.obj.style.top=this.endPoint.top;
  42. }
  43. },magnifyStack:function(){
  44. if(this.stop){
  45. return;
  46. }
  47. var _8=this;
  48. if(this.animTimer==null){
  49. this.numTimes=this.maxTimes;
  50. this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
  51. this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
  52. this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
  53. this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
  54. }
  55. this.startDim.width+=this.wChange;
  56. this.startDim.height+=this.hChange;
  57. this.obj.style.width=this.startDim.width+"px";
  58. this.obj.style.height=this.startDim.height+"px";
  59. this.startPoint.left+=this.xChange;
  60. this.startPoint.top+=this.yChange;
  61. this.obj.style.left=this.startPoint.left+"px";
  62. this.obj.style.top=this.startPoint.top+"px";
  63. this.obj.style.position="fixed";
  64. this.numTimes--;
  65. if(this.callback!=null){
  66. this.callback(this.numTimes);
  67. }
  68. if(this.numTimes<5){
  69. this.animDelay+=10;
  70. }
  71. this.animTimer=setTimeout(function(){
  72. _8.magnifyStack();
  73. },this.animDelay);
  74. if(this.numTimes==0){
  75. this.reset(cooliris_wc_EffectType.ANIMATE);
  76. this.obj.style.width=this.endDim.width;
  77. this.obj.style.height=this.endDim.height;
  78. this.obj.style.left=this.endPoint.left;
  79. this.obj.style.top=this.endPoint.top;
  80. }
  81. },expand:function(){
  82. var _9=this;
  83. if(this.animTimer==null){
  84. this.numTimes=this.maxTimes;
  85. this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
  86. this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
  87. }
  88. this.startDim.width+=this.wChange;
  89. this.startDim.height+=this.hChange;
  90. this.obj.style.width=this.startDim.width+"px";
  91. this.obj.style.height=this.startDim.height+"px";
  92. this.obj.style.position="fixed";
  93. if(this.callback!=null){
  94. this.callback(this.endPoint.left,this.endPoint.top,this.startDim.width,this.startDim.height);
  95. }
  96. this.numTimes--;
  97. if(this.numTimes<5){
  98. this.animDelay+=10;
  99. }
  100. this.animTimer=setTimeout(function(){
  101. _9.expand();
  102. },this.animDelay);
  103. if(this.numTimes==0){
  104. this.reset(cooliris_wc_EffectType.ANIMATE);
  105. this.obj.style.width=this.endDim.width;
  106. this.obj.style.height=this.endDim.height;
  107. if(this.endCallback!=null){
  108. this.endCallback(this.endPoint.left,this.endPoint.top,this.startDim.width,this.startDim.height);
  109. }
  110. }
  111. },fadeIn:function(){
  112. var _a=this;
  113. if(this.animTimer==null){
  114. this.numTimes=this.maxTimes;
  115. this.opacityChange=(1-0.1)/this.numTimes;
  116. this.obj.style.opacity=0;
  117. }
  118. var _b=this.obj.style.opacity;
  119. _b=parseFloat(_b)+this.opacityChange;
  120. this.obj.style.opacity=_b;
  121. this.numTimes--;
  122. if(this.numTimes<5){
  123. this.animDelay+=10;
  124. }
  125. this.animTimer=setTimeout(function(){
  126. _a.fadeIn();
  127. },this.animDelay);
  128. if(this.numTimes==0){
  129. this.reset(cooliris_wc_EffectType.ANIMATE);
  130. }
  131. },animate:function(){
  132. var _c=this;
  133. if(this.animTimer==null){
  134. this.numTimes=this.maxTimes;
  135. this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
  136. this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
  137. }
  138. this.startPoint.left+=this.xChange;
  139. this.startPoint.top+=this.yChange;
  140. this.obj.style.left=this.startPoint.left+"px";
  141. this.obj.style.top=this.startPoint.top+"px";
  142. this.obj.style.position="fixed";
  143. this.numTimes--;
  144. if(this.numTimes<5){
  145. this.animDelay+=10;
  146. }
  147. this.animTimer=setTimeout(function(){
  148. _c.animate();
  149. },this.animDelay);
  150. if(this.numTimes==0){
  151. this.reset(cooliris_wc_EffectType.ANIMATE);
  152. this.obj.style.left=this.endPoint.left;
  153. this.obj.style.top=this.endPoint.top;
  154. }
  155. },drag:function(){
  156. },reset:function(_d){
  157. switch(_d){
  158. case cooliris_wc_EffectType.ANIMATE:
  159. this.numTimes=this.maxTimes;
  160. clearTimeout(this.animTimer);
  161. this.animTimer=null;
  162. this.animDelay=100;
  163. break;
  164. }
  165. },setObject:function(_e,_f,_10,_11){
  166. this.obj=_e;
  167. this.startPoint=_f;
  168. this.endPoint=_10;
  169. this.type=_11;
  170. }};
  171. function cooliris_wc_Point(_12,top){
  172. this.left=_12;
  173. this.top=top;
  174. var _14=document.getElementById("content");
  175. this.bottom=(_14.boxObject.y+_14.boxObject.height)-this.top;
  176. this.right=(_14.boxObject.x+_14.boxObject.width)-this.left;
  177. }
  178. function cooliris_wc_Dim(_15,_16){
  179. this.width=_15;
  180. this.height=_16;
  181. }
  182. var cooliris_wc_EffectType={ANIMATE:"0",DRAG:"drag",RESIZE:"resize",EXPAND:"expand"};
  183.  
  184.